#ifndef __SE_THREAD_HPP__
#define __SE_THREAD_HPP__

#include "NonCopyable.hpp"

#include <pthread.h>

#include <functional>

namespace se {

class Thread final : private NonCopyAble {
    using ThreadCallBack = std::function<void()>;
public:
    explicit Thread(ThreadCallBack &&callBack);
    explicit Thread(const ThreadCallBack &callBack);

    /**
     * @brief 线程开始执行
     * 
     */
    void start();

    /**
     * @brief 等待线程结束
     * 
     */
    void join();

    ~Thread() = default;

private:
    static void *threadFunction(void *argument);

private:
    pthread_t _threadId;
    ThreadCallBack _callBack;
};

}  // namespace se

#endif
